<template>
	<view class="order-panel" @tap="goSelf(orderInfo)">
		<view class="order-panel-header">
			<view class="order-panel-time">
				<view>{{ orderInfo.create_time }}</view>
			</view>
			<view class="order-panel-status" :style="{color: colorStyleForStatus(orderInfo.status)}">
				{{ orderInfo.status_desc }}
			</view>
		</view>
		<view class="order-panel-content">
			<image :src="orderInfo.imges" mode="aspectFill" style="width: 160rpx;height: 160rpx;"></image>
			<view>
				<view class="xxl black">
					{{orderInfo.goods_name}}
				</view>
				<view class="nr lighter mt20">订单编号：{{ orderInfo.order_sn }}</view>
			</view>
		</view>
	</view>
</template>


<script>
	export default {
		name: "recycle-order-list-panel",
		props: {
			data: {
				type: Object,
				required: true
			}
		},

		data() {
			return {
				orderInfo: {}, // 订单信息数据
			}
		},

		methods: {
			// 状态颜色
			colorStyleForStatus(stat) {
				switch (stat) {
					case 0:
						return '#24A3FF'; // 待估价
					case 1:
						return '#24A3FF'; // 待接受
					case 2:
						return '#24A3FF'; // 待寄出
					case 3:
						return '#24A3FF'; // 待验收
					case 4:
						return '#666666'; // 已完成
					case 5:
						return '#da533c'; // 拒收
					case 6:
						return '#da533c'; // 关闭交易
					default:
						return '#666666';
				}
			},

			// 点击事件处理
			goSelf(data) {
				this.$emit('on-self', data);
			}
		},

		created() {
			this.orderInfo = this.data;
		}
	}
</script>


<style scoped>
	.order-panel {
		padding: 0 20rpx;
		border-radius: 10px;
		background-color: #FFFFFF;
	}

	.order-panel-header {
		display: flex;
		justify-content: space-between;
		align-items: center;
		height: 80rpx;
		border-bottom: 1rpx dashed #E5E5E5;
		font-size: 26rpx;
	}

	.order-panel-time {
		display: flex;
		align-items: center;
		color: #999999;
	}

	.order-panel-sign {
		/* border: 1px solid #01D171; */
		color: #FFFFFF;
		border-radius: 2px;
		padding: 0 4rpx;
		margin-right: 10rpx;
		background-color: #01D171;
	}

	.order-panel-status {
		color: #666666;
		font-size: 30rpx;
	}

	.order-panel-content {
		display: flex;
		margin-top: 30rpx;
		padding-bottom: 30rpx;
		gap: 20rpx;
	}
</style>